/****************************************************************
 *Author:       zxx
 *UnityVersion：2019.4.1f1
 *Date:         2020/07/30 14:35:46
 *Description:    
*****************************************************************/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[RequireComponent(typeof(BoxCollider2D))]
public class DiamondController : MonoBehaviour {

    private Animator animator;

    private AudioSource ass;
    // Use this for initialization
    void Start () {
        animator = GetComponent<Animator>();
        ass = GetComponent<AudioSource>();

    }
    public AudioClip Collectable;

    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag == "Player")
        {
            GameMananger.Instance.UpdateDiamondCount();
            ass.PlayOneShot(Collectable);

            animator.Play(Animator.StringToHash("DiamondEat"));

            Destroy(gameObject, 1.0f);
        }
    }
}

